package com.ruoyi.personnel.oa.meeting.service;

import com.ruoyi.personnel.oa.approve.domain.ApproveDomain;
import com.ruoyi.personnel.oa.approve.mapper.ApproveMapper;
import com.ruoyi.personnel.oa.meeting.domain.MeetingCond;
import com.ruoyi.personnel.oa.meeting.domain.MeetingDomain;
import com.ruoyi.personnel.oa.meeting.domain.MeetingDto;
import com.ruoyi.personnel.oa.meeting.mapper.MeetingMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 会议
 * 业务处理层
 */
@Service
public class MeetingServiceImpl implements IMeetingService{
    @Autowired
    private MeetingMapper meetingMapper;
    @Autowired
    private ApproveMapper approveMapper;

    /**
     * 根据搜索条件所有会议记录
     * @param cond 搜索条件
     * @return
     */
    @Override
    public List<MeetingDto> selectMeetingList(MeetingCond cond) {
        return meetingMapper.selectMeetingList(cond);
    }

    /**
     * 新增会议
     * @param meeting
     * @return
     */
    @Override
    public int insertMeeting(MeetingDomain meeting) {
        // 将会议申请添加到待审批列表
//        ApproveDomain approve = new ApproveDomain(meeting.getMeetingId(), meeting.getMeetingTitle(), "0", meeting.getUserId(), meeting.getCreateTime());
//        approveMapper.insertApprove(approve);
        return meetingMapper.insertMeeting(meeting);
    }

    /**
     * 修改会议
     * @param meeting
     * @return
     */
    @Override
    public int updateMeeting(MeetingDomain meeting) {
        return meetingMapper.updateMeeting(meeting);
    }

    /**
     * 删除会议
     * 仅修改删除标志
     * @param meeting
     * @return
     */
    @Override
    public int updateMeetingDeleteFlag(MeetingDomain meeting) {
        return meetingMapper.updateMeetingDeleteFlag(meeting);
    }
}
